
// Movemap used in keyboard-only mode
if(isObject(LogicInput_MoveMap_Keys)){ LogicInput_MoveMap_Keys.delete(); }
new ActionMap(LogicInput_MoveMap_Keys);

$LogicInput_KeyCount = 0;
function LogicInput_AddKey(%key, %device) {
	if(%device $= "") {
		%device = "keyboard";
		%map = LogicInput_MoveMap_Keys;
	} else if(%device $= "mouse0") {
		%map = LogicInput_MoveMap_Axis;
	}
	%keyidx = $LogicInput_KeyCount;
	$LogicInput_KeyCount++;
	eval("function LogicInput_KeyHit" @ %keyidx @ "(%s) { LogicInput_SendKey(\"" @ expandEscape(%key) @ "\", %s); }");
	%map.bind(%device, %key, "LogicInput_KeyHit" @ %keyidx);
}

// Movemap added on for mouse mode
if(isObject(LogicInput_MoveMap_Axis)){ LogicInput_MoveMap_Axis.delete(); }
new ActionMap(LogicInput_MoveMap_Axis);

$LogicInput_AxisCount = 0;
function LogicInput_AddAxis(%axis) {
	%axisidx = $LogicInput_AxisCount;
	$LogicInput_AxisCount++;
	eval("function LogicInput_AxisMove" @ %axisidx @ "(%x) { LogicInput_SendAxis(\"" @ expandEscape(%axis) @ "\", %x); }");
	LogicInput_MoveMap_Axis.bind("mouse0", %axis, "LogicInput_AxisMove" @ %axisidx);
}

// List of keys and axes to capture
LogicInput_AddAxis("xaxis");
LogicInput_AddAxis("yaxis");
LogicInput_AddAxis("zaxis");
LogicInput_AddKey("button0", "mouse0");
LogicInput_AddKey("button1", "mouse0");
LogicInput_AddKey("button2", "mouse0");
LogicInput_AddKey("button3", "mouse0");
LogicInput_AddKey("button4", "mouse0");
LogicInput_AddKey("backspace");
LogicInput_AddKey("tab");
LogicInput_AddKey("return");
LogicInput_AddKey("space");
LogicInput_AddKey("end");
LogicInput_AddKey("home");
LogicInput_AddKey("left");
LogicInput_AddKey("up");
LogicInput_AddKey("right");
LogicInput_AddKey("down");
LogicInput_AddKey("insert");
LogicInput_AddKey("delete");
LogicInput_AddKey("0");
LogicInput_AddKey("1");
LogicInput_AddKey("2");
LogicInput_AddKey("3");
LogicInput_AddKey("4");
LogicInput_AddKey("5");
LogicInput_AddKey("6");
LogicInput_AddKey("7");
LogicInput_AddKey("8");
LogicInput_AddKey("9");
LogicInput_AddKey("a");
LogicInput_AddKey("b");
LogicInput_AddKey("c");
LogicInput_AddKey("d");
LogicInput_AddKey("e");
LogicInput_AddKey("f");
LogicInput_AddKey("g");
LogicInput_AddKey("h");
LogicInput_AddKey("i");
LogicInput_AddKey("j");
LogicInput_AddKey("k");
LogicInput_AddKey("l");
LogicInput_AddKey("m");
LogicInput_AddKey("n");
LogicInput_AddKey("o");
LogicInput_AddKey("p");
LogicInput_AddKey("q");
LogicInput_AddKey("r");
LogicInput_AddKey("s");
LogicInput_AddKey("t");
LogicInput_AddKey("u");
LogicInput_AddKey("v");
LogicInput_AddKey("w");
LogicInput_AddKey("x");
LogicInput_AddKey("y");
LogicInput_AddKey("z");
LogicInput_AddKey("numpad0");
LogicInput_AddKey("numpad1");
LogicInput_AddKey("numpad2");
LogicInput_AddKey("numpad3");
LogicInput_AddKey("numpad4");
LogicInput_AddKey("numpad5");
LogicInput_AddKey("numpad6");
LogicInput_AddKey("numpad7");
LogicInput_AddKey("numpad8");
LogicInput_AddKey("numpad9");
LogicInput_AddKey("*");
LogicInput_AddKey("+");
LogicInput_AddKey("numpadenter");
LogicInput_AddKey("minus");
LogicInput_AddKey("numpaddecimal");
LogicInput_AddKey("/");
LogicInput_AddKey("f1");
LogicInput_AddKey("f2");
LogicInput_AddKey("f3");
LogicInput_AddKey("f4");
LogicInput_AddKey("f5");
LogicInput_AddKey("f6");
LogicInput_AddKey("f7");
LogicInput_AddKey("f8");
LogicInput_AddKey("f9");
LogicInput_AddKey("f10");
LogicInput_AddKey("f11");
LogicInput_AddKey("f12");
LogicInput_AddKey("lshift");
LogicInput_AddKey("rshift");
LogicInput_AddKey("lcontrol");
LogicInput_AddKey("rcontrol");
LogicInput_AddKey("lalt");
LogicInput_AddKey("ralt");
LogicInput_AddKey(";");
LogicInput_AddKey(",");
LogicInput_AddKey(".");
LogicInput_AddKey("/");
LogicInput_AddKey("`");
LogicInput_AddKey("[");
LogicInput_AddKey("\\");
LogicInput_AddKey("]");
LogicInput_AddKey("=");
LogicInput_AddKey("apostrophe");
LogicInput_AddKey("pageup");
LogicInput_AddKey("pagedown");
LogicInput_AddKey("escape");
